}
static GtkATContext *
-create_at_context (GtkModelButton *button)
+create_at_context (GtkModelButton *button,
+ GtkATContext *old_context)
{
GdkDisplay *display = _gtk_widget_get_display (GTK_WIDGET (button));
GtkAccessibleRole role;
break;
}
+ if (old_context != NULL)
+ return gtk_at_context_clone (old_context, role, GTK_ACCESSIBLE (button), display);
+
return gtk_at_context_create (role, GTK_ACCESSIBLE (button), display);
}
GtkModelButton *button = GTK_MODEL_BUTTON (accessible);
if (button->at_context == NULL)
- button->at_context = create_at_context (button);
+ button->at_context = create_at_context (button, NULL);
return button->at_context;
}
else
gtk_accessible_reset_state (GTK_ACCESSIBLE (button),
GTK_ACCESSIBLE_STATE_CHECKED);
+
+ gtk_accessible_update_relation (GTK_ACCESSIBLE (button),
+ GTK_ACCESSIBLE_RELATION_LABELLED_BY, button->label, NULL,
+ -1);
}
static void
gtk_model_button_set_role (GtkModelButton *self,
GtkButtonRole role)
{
+ GtkATContext *old_context;
+
if (role == self->role)
return;
update_node_name (self);
gtk_model_button_update_state (self);
- g_set_object (&self->at_context, create_at_context (self));
+ /* Replace the old context, if any, with a new context */
+ old_context = g_steal_pointer (&self->at_context);
+ self->at_context = create_at_context (self, old_context);
+ g_clear_object (&old_context);
update_accessible_properties (self);